package models.mappers;

import java.util.LinkedList;
import java.util.List;

import org.apache.ibatis.annotations.Select;

import models.Region;

public interface RegionMapper {
	/**
	 * 获取子节点
	 *
	 * @Title: getRegion 
	 * @param pid
	 * @return
	 * @return: List<Region>
	 */
	@Select("select id,text,pid as attributes,case isend when 1 then 'open' else 'closed' end as state from region where pid=#{pid}")
	LinkedList<Region> getRegion(String pid);
	/**
	 * 获取根节点
	 *
	 * @Title: getFRegion 
	 * @return
	 * @return: List<Region>
	 */
	@Select("select id,text,pid as attributes,case isend when 1 then 'open' else 'closed' end as state from region where pid is null")
	LinkedList<Region> getFRegion();
	/**
	 * 根据id获取region对象
	 *
	 * @Title: getById 
	 * @param id
	 * @return
	 * @return: Object
	 */
	@Select("select * from region where id=#{id}")
	Region getById(String id);
	
}
